< previous page page_620 next page >

Page 620
Note
The x and y coordinates are based on the current screen display size. The values in the preceding statement assume that the screen is set at 640×480.

Now, run the application and click the command button. The character should now appear in the middle of the screen. To have a little fun with this, move the MoveTo command after the Show statement to see the move animation for the character.
Using the Request Object
Before looking at other animations you can have the character perform, you need to know how to tell when the character finishes processing a request. Because the server asynchronously processes some methods (such as Load, Play, and Speak), your application code can continue to execute while the method is completing. When an application calls one of these methods, the control creates and returns a Request object for the request. You can use this object to check the status of the method by defining an object and then setting it to the request made. The following code shows how this is done:
Dim MyRequest As Object
Set MyRequest = Agent1.Characters.Load(Genie,_
  c:\program files\microsoft agent\characters\Genie.acs)
The Request object has a Status property that can be used to check for the current status of a request. Table B.1 lists the five status codes that can occur for a character.
TABLE B.1. USING THERequestOBJECT'SStatusPROPERTY.
StatusDefinition
0Successfully completed
1Failed
2Pending
3Interrupted
4In progress

This property would be used with some type of loop process to keep the application from continuing until the request was completed.
Animating the Character
In addition to the MoveTo and GestureAt methods, each character has a long list of animations that you can play when needed. Each animation interacts with users when

 
< previous page page_620 next page >

If you like this book, buy it!